package a;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;


public class FiveFive {
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int n1=sc.nextInt();
        PersonOverride[] persons1=new PersonOverride[n1];
        for(int i=0;i<n1;i++)
            persons1[i]=new PersonOverride();
        int n2=sc.nextInt();
        ArrayList<PersonOverride> persons2=new ArrayList<PersonOverride>();
        int j=0;
        while(j<n2)
        {
            PersonOverride p=new PersonOverride(sc.next(),sc.nextInt(),sc.nextBoolean());
            if(persons2.contains(p))
            {
                j++;
                continue;
            }
            else
            {
                j++;
                persons2.add(p);
            }


        }

        for(int i=0;i<persons1.length;i++)
        {
            System.out.println(persons1[i].toString());
        }
        for(PersonOverride tmp:persons2)
        {
            System.out.println(tmp.toString());
        }


        System.out.println(persons2.size());
        System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
        sc.close();

    }
}


class PersonOverride{
    private String name;
    private boolean gender;
    private int age;

    public PersonOverride()
    {

        this("default",1,true);
    }

    public PersonOverride(String name, int age,boolean gender) {
        this.name = name;
        this.gender = gender;
        this.age = age;
    }

    @Override
    public String toString()
    {
        return this.name+'-'+this.age+'-'+this.gender;
    }

    @Override
    public boolean equals(Object obj)
    {
        if(obj instanceof PersonOverride)
        {
            PersonOverride a=(PersonOverride)obj;
            return (this.name.equals(a.name))&&(this.age==a.age)&&(this.gender==a.gender);
        }

        else
            return super.equals(obj);
    }
}

